<template>
	<scroll-view scroll-y class="container" lower-threshold="50" @scrolltolower="scrolltolower" :style="'height:'+height+'px'">
		<view class="cont-list">
			<view class="cont-item" v-for="(item,index) in dataArr" @click="gotoDetail(item.id)">
				<scroll-view class="land-list-box hasmt" scroll-x>
					<view class="item">
						<view class="cover common-bg-img" :style="'background-image:url('+item.imageUrl+')'"></view>
						<view class="info">
							<view class="text">{{item.area}}m<text class="square-unit">2</text></view>
							<!-- <view class="area">最少配送次数：{{land.detail.num}}</view> -->
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	export default {
		data() {
			return {
				height:0,
				page:1,
				isLoad:true,
				dataArr:[]
			};
		},
		onShow() {
			
		},
		onLoad(options) {
			const that = this
			this.height = uni.getSystemInfoSync().windowHeight
			this.getList();
		},
		onShareAppMessage() {
			const that = this
			return {
				title: '果王来了',
				imageUrl: 'https://shopmalling-asset.oss-cn-hangzhou.aliyuncs.com/share.jpg',
				path: '/pages/index/index'
			}
		},
		methods: {
			getList(reload){
				const that = this
				if(reload){
					this.page = 1
					this.isLoad = true
					this.dataArr = []
				}
				uni.showLoading({
					title: '正在加载'
				})
				that.$api.request('treeOrder', 'treeDetailOrder',{}, failres => {
					that.$api.msg(failres.errmsg)
					uni.hideLoading()
				}).then(res => {
					debugger
					let data = res.data
					let arr = that.dataArr
					if(data.length > 0){
						that.isLoad = true
					}
					data.forEach(item => {
						arr.push(item)
					})
					that.dataArr = arr
					uni.hideLoading()
				})
			},
			gotoDetail(id){
				uni.navigateTo({
					url:'/pages/user/treedetail?id='+id
				})
			},
			slcTab(index){
				this.categoryIndex = index
				this.getList(true)
			},
			scrolltolower(e){
				if(this.isLoad){
					this.isLoad = false
					
					this.getList()
				}
			}
		},
	}
</script>

<style lang="less" scoped>
	.container{
		background-color: #F9F9F9;
	}
	.tab-bar-list{
		display: flex;
		align-items: center;
		padding:30upx 0 20upx;
		.item{
			padding:10upx 45upx;
			font-size: 36upx;
			color: #999999;
			&:first-child{
				margin-left:60upx;
			}
			&.active{
				color: #009D44;
				border:2upx solid #009D44;
				border-radius: 60upx;
				font-weight: bold;
			}
			&:not(:last-child){
				margin-right:50upx;
			}
		}
	}
	.cont-list{
		padding:0 20upx;
		.cont-item{
			margin-bottom: 20upx;
			padding:30upx;
			background:rgba(255,255,255,1);
			border-radius:20upx;
			.status{
				color: #009D44;
				font-size: 24upx;
			}
			.cover{
				width:144upx;
				height:144upx;
				margin-right: 24upx;
				border-radius: 20upx;
				flex-shrink: 0;
			}
			.title{
				font-size: 30upx;
				color: #333333;
			}
			.area{
				margin-top: 10upx;
				color: #333333;
				font-size: 24upx;
			}
			.other-text{
				margin-top: 40upx;
				color: #333333;
				font-size: 24upx;
			}
			.symbol{
				width:23upx;
				height: 23upx;
				margin-right:8upx;
			}
			.price{
				color: #FF4E00;
				font-size: 30upx;
				line-height: 1;
			}
		}
	}
	.btns-box{
		display: flex;
		align-items: center;
		justify-content: flex-end;
		margin-top: 30upx;
		padding-top:30upx;
		border-top: 2upx solid #f0f0f0;
		.pay-btn{
			border:2upx solid #009D44;
			color: #009D44;
			font-size: 24upx;
			border-radius: 30upx;
			padding:10upx 30upx;
		}
	}
	.land-list-box{
		white-space: nowrap;
		margin-top: 30upx;
		.item{
			display: inline-block;
			margin-right: 20upx;
			.cover{
				width:80upx;
				height: 80upx;
				margin-right:20upx;
				border-radius: 20upx;
				flex-shrink: 0;
			}
			.info{
				font-size: 24upx;
			}
		}
	}
</style>
